<%@ page import="java.util.ArrayList" %>
<%@ page import="com.lumm.model.Staff" %>
<%@ page import="com.lumm.util.Constants" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: qhzhy
  Date: 2018/9/12
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>

<%
    request.setAttribute("maritalStatus",Constants.maritalStatus);
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    request.setAttribute("formatter",formatter);
%>

${msg}

<c:forEach items="${userList}" varStatus="i" var="user">

    <div class="row" id="user-${user.userId}">
        <div class="col-xs-1 user-id">${user.userId}</div>
        <div class="col-xs-1">
            <img src="/upload/images/${user.profilePhoto}" style="width: 40px;height: 40px;"/>
        </div>
        <div class="col-xs-1">${user.nickname}</div>
        <div class="col-xs-1">${user.gender}</div>
        <div class="col-xs-1">${maritalStatus[user.maritalStatus]}</div>
        <div class="col-xs-2">${user.email}</div>
        <div class="col-xs-2">${user.phoneNum}</div>
        <div class="col-xs-2" id="user-data-${user.userId}"
             data='({"name":"${user.nickname}","gender":"${user.gender}",maritalStatus:"${user.maritalStatus}","email":"${staff.email}","phoneNum":"${user.phoneNum}","birthday":"${formatter.format(user.birthday)}"})'>
            <button onclick='beforeUpdateUserInfo(${user.userId})' class="btn btn-success btn-xs" data-toggle="modal"
                    data-target="#update-user-info-dialog">
                修改
            </button>
            <button onclick="beforeDeleteUser(${user.userId})" class="btn btn-danger btn-xs" data-toggle="modal"
                    data-target="#deleteUserAlert">删除
            </button>
        </div>
    </div>
</c:forEach>


